<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改公共字段管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-pubfld-edit" th:object="${mdMedPubfld}">
            <input name="naDimtp" th:field="*{naDimtp}" type="hidden">
            <input name="naJavatp" th:field="*{naJavatp}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">字段编码：</label>
                <div class="col-sm-8">
                    <input name="idPubfld" th:field="*{idPubfld}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">字段名称：</label>
                <div class="col-sm-8">
                    <input name="na" th:field="*{na}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">JAVA字段类型名称：</label>
                <div class="col-sm-8">
                    <select name="euJavatp" class="form-control m-b" th:value="*{euJavatp}">
                        <option value="12" th:selected="*{euJavatp} eq 12 ">VARCHAR</option>
                        <option value="-9" th:selected="*{euJavatp} eq -9 ">NVARCHAR</option>
                        <option value="2" th:selected="*{euJavatp} eq 2">NUMERIC</option>
                        <option value="3" th:selected="*{euJavatp} eq 3 ">DECIMAL</option>
                        <option value="4" th:selected="*{euJavatp} eq 4 ">INTEGER</option>
                        <option value="-5" th:selected="*{euJavatp} eq -5 ">BIGINT</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">长度：</label>
                <div class="col-sm-8">
                    <input name="numLth" th:field="*{numLth}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">精度：</label>
                <div class="col-sm-8">
                    <input name="numPrec" th:field="*{numPrec}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">维度类型：</label>
                <div class="col-sm-8">
                    <select name="sdDimtp" class="form-control m-b" th:with="type=${@baseSd.getItem('dim_type')}" >
                        <option th:each="item : ${type}" th:text="${item.na}" th:value="${item.cd}" th:selected="*{sdDimtp} eq ${item.cd} "></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">维度表：</label>
                <div class="col-sm-8">
                    <input name="cdTbDim" th:field="*{cdTbDim}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="des" th:field="*{des}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "md/med/pubfld";
        $("#form-pubfld-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {

                var naJavatp = $('#form-pubfld-edit').find("select[name=euJavatp] option:selected").text();
                $('#form-pubfld-edit').find("input[name=naJavatp]").val(naJavatp);
                var naDimtp = $('#form-pubfld-edit').find("select[name=sdDimtp] option:selected").text();
                $('#form-pubfld-edit').find("input[name=naDimtp]").val(naDimtp);
                $.operate.save(prefix + "/edit", $('#form-pubfld-edit').serialize());
            }
        }
    </script>
</body>
</html>